/**
一个开关，有开和关的状态
 */
package kgame5.kgui.kcomp {
import flash.display.*;

public class SmartSwitch{
	//_________________Property____________________
	private var 
		xb_on:SmartButton,//点了这个btn就切换到on的状态
		xb_off:SmartButton;//点了这个btn就切换到off的状态
	
	private var bIsOn:Boolean=false;
	private var bIsActive:Boolean=false;
	//____________________Method______________________
	public function SmartSwitch(mc_xb_on:MovieClip,mc_xb_off:MovieClip){
		
		xb_on=new SmartButton(mc_xb_on);
		xb_off=new SmartButton(mc_xb_off);
		
		On();
		active();
	}
	public function getXBOn():SmartButton{
		return xb_on;
	}
	public function getXBOff():SmartButton{
		return xb_off;
	}
	
	public function isOn():Boolean{
		return bIsOn;
	}
	public function On(){
		bIsOn=true;//处在开的状态
		xb_on.getMC().visible=false;
		xb_off.getMC().visible=true;
	}
	public function Off(){
		bIsOn=false;//处在关的状态
		xb_on.getMC().visible=true;
		xb_off.getMC().visible=false;
	}
	public function isActive():Boolean{
		return bIsActive;
	}
	public function active(){
		bIsActive=true;
		xb_on.active();
		xb_off.active();
	}
	public function deactive(){
		bIsActive=false;
		xb_on.deActive();
		xb_off.deActive();
	}
}//end of class
}